{include file=header.html}
<script>
    var cate_height;
    var scroll_lock=false;
    $(function(){
        cate_height=$(".categories-container").eq(0).height()+16;
        $(window).bind("scroll",function(){
            if(!scroll_lock){
            var sTop = $(window).scrollTop();
            var max_index=$(".category-items .col:eq(0) .category-item:eq(0)").attr('data-id');
            $(".category-items .col:eq(0) .category-item").each(function(){
                if((($(this).offset().top)-cate_height)<=sTop){
                    max_index=$(this).attr('data-id');
                    
                }
            });
            $(".categories-container .ui-category-item").removeClass('selected');
            $("#cate_item_"+max_index).addClass('selected');
        }
        })
    })
    function scroll_cate(id){
        scroll_lock=true;
        $('html,body').animate({scrollTop: (($('#cate_'+id).offset().top)-cate_height)},function(){
            var time=setInterval(function(){
                scroll_lock=false;
                clearInterval(time);
            },50);
             
        });
        
        $(".categories-container .ui-category-item").removeClass('selected');
            $("#cate_item_"+id).addClass('selected');
            
    }
</script>
<div id="main" class="w-full">
<div id="page-category" class="w mt10">
	<div class="w" area="top" data-position="1" widget_type="area">
		<!--{widgets page=gcategory area=top}-->
	</div>
    <div class="search-type mb20 clearfix">
			<div class="float-right btn-type">
				<a href="{url app=category}" class="current">{$lang.all_gcategory}</a>
				<a href="{url app=category&act=store}">{$lang.all_scategory}</a>
                                <a href="{url app=brand}">{$lang.all_brand}</a>
			</div>                       
		</div>
	<div class="gcategory left float-left">
            <div class="categories">
                <div class="categories-container clearfix">
		<!--{foreach from=$gcategorys item=gcategory name=fe_gc}-->
                <a class="ui-category-item {if $smarty.foreach.fe_gc.first}selected{/if}" href="javascript:void(0)" onclick="scroll_cate({$gcategory.id})" id="cate_item_{$gcategory.id}">{$gcategory.value|escape}</a>
		<!--{/foreach}-->
                <div style="clear:both;height:0; display:block; overflow:hidden"></div>
                </div>
                </div>
                <div class="category-items clearfix">
                    <div class="col float-left">
		<!--{foreach from=$gcategorys item=gcategory name=fe_gc}-->
                        <div class="category-item m" id="cate_{$gcategory.id}" data-id="{$gcategory.id}">
			<div class="mt">
                            <h2 class="item-title">
                                <b></b>
                                <i></i><a href="{url app=search&cate_id=$gcategory.id}"><span>{$gcategory.value|escape}</span></a>
                            </h2>
			<div class="mc">
                            <!--{if $gcategory.cate_goods}-->
                            <div class="item-hot clearfix">
                                <!--{foreach from=$gcategory.cate_goods item=goods}-->
                                <a href="index.php?app=goods&id={$goods.goods_id}" target="_blank"><img src="{$goods.default_image}" width="130" height="130" ></a>
                                <!--{/foreach}-->
                            </div>
                            <div class="item-info">{$lang.hot_goods}</div>
                            <!--{/if}-->
                            <div class="items">
				<!--{foreach from=$gcategory.children item=child}-->
                                <dl class="clearfix">
				<dt><a href="{url app=search&cate_id=$child.id}">{$child.value|escape}</a></dt>
                                <dd>
                                    <!--{foreach from=$child.children item=child2}-->
                                    <a href="{url app=search&cate_id=$child2.id}">{$child2.value|escape}</a>
                                    <!--{/foreach}-->
                                </dd>
                                <div style="clear:both;height:0; display:block; overflow:hidden"></div>
                                </dl>
				<!--{/foreach}-->
                                </div>
			</div>
                        </div>
                            </div>
                        <!--{if $half_count == $smarty.foreach.fe_gc.iteration}-->
                        </div>
                
                        <div class="col float-left" style="margin-right: 0">
                        <!--{/if}-->
		
		<!--{/foreach}-->
                </div>
                <div style="clear:both;height:0; display:block; overflow:hidden"></div>
                </div>
	</div>
    <div class="right float-right">
        <div class="hot-items m">
        <h2 class="item-bar mt"><i></i> <span>{$lang.hot_sell_ranking_list}</span></h2>
        <div class="mc">
        <!--{foreach from=$cate_hot_goods item=goods }-->
        <div class="hot-item">
            <div class="p-img">
                <a href="index.php?app=goods&id={$goods.goods_id}" target="_blank"><img src="{$goods.default_image}" width="220" height="220" alt=""></a>
            </div>
            <div class="p-info">
                <a class="p-title" href="index.php?app=goods&id={$goods.goods_id}">{$goods.goods_name|escape}</a>
                <span class="p-price"><em>{$goods.price|price}</em></span>
            </div>
        </div>
        <!--{/foreach}-->
        </div>
        </div>
    </div>
    <div style="clear:both;height:0; display:block; overflow:hidden"></div>
</div>
</div>
<script src="{res file=js/posfixed.js}"></script>
<script>
    
                                //导航那个悬浮
                                $(".categories-container").posfixed({
                                    distance: 0,
                                    pos: "top",
                                    type: "while",
                                    hide: false
                                });
</script>
{include file=server.html}
{include file=footer.html}